Fix #1612: Self-hosted deployments break on update due to missing datab#1626
Open
danielalanbates wants to merge 1 commit intoCapSoftware:mainfrom
Open
Fix #1612: Self-hosted deployments break on update due to missing datab#1626danielalanbates wants to merge 1 commit intoCapSoftware:mainfrom
danielalanbates wants to merge 1 commit intoCapSoftware:mainfrom
Conversation
…rrors migrateDb() was not awaiting the runMigrate() promise chain, causing migrations to fire-and-forget. The caller (instrumentation.node.ts) would receive a resolved promise immediately, log "Migrations run successfully!" before any migration ran, and the app would start serving requests against a stale schema. Additionally, the second .catch() silently swallowed non-orgId errors, hiding migration failures entirely. Both issues are fixed: the chain is now awaited and unhandled errors are re-thrown. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1612
Summary
This PR addresses: Self-hosted deployments break on update due to missing database migrations
Changes
Testing
Please review the changes carefully. The fix was verified against the existing test suite.
This PR was created with the assistance of Claude Sonnet 4.6 by Anthropic | effort: low. Happy to make any adjustments!
Greptile Summary
Fixed critical bug where
migrateDb()was not awaiting therunMigrate()promise, causing unhandled promise rejections in self-hosted deployments. The PR adds the missingawaitkeyword on line 23 and adds a missingthrow e;statement on line 37 in the second catch block to properly rethrow errors that don't match the orgId migration error pattern.Key changes:
awaitbeforerunMigrate()call to properly handle async executionthrow e;in second catch block to rethrow non-orgId migration errorsThese changes ensure that database migration errors are properly surfaced to the caller (
instrumentation.node.ts), allowing the retry logic and error handling to work correctly.Confidence Score: 5/5
Important Files Changed
awaittorunMigrate()call and rethrows unhandled errors in the second catch blockLast reviewed commit: 114f62a